type Person = {
    name: string
    age: number
    isSinger: boolean
}
const p1: Person = {
    name: '张三',
    age: 18,
    isSinger: false,
}

const p2: Person = {
    name: '李四',
    age: 28,
    isSinger: true,
}

// 2.  type + 交叉类型模拟继承
type animal = {
    height: string
    weight: string
    age: number
}

type person = animal & {
    name: string

}
type cat = animal & {
    brand: string
}
const zhang: person = {
    name: '张三',
    height: '1.78m',
    weight: '60kg',
    age: 28
}

const tiaoTiao: cat = {
    brand: '金渐层',
    height: '35cm',
    weight: '2.6kg',
    age: 2
}

type Res = {
    code: number
    msg: string
    data: {
        title: string
        content: string
    }
}

const res: Res = {
    code: 200,
    msg: 'success',
    data: {
        title: '666',
        content: '666777888',
    },
}

// 4. type和interface的区别
// 非常适合底层封装
interface Dog {
    name: string
}

interface Dog {
    age: number
}

const dog: Dog = {
    name: '旺财',
    age: 18,
}

export { p1, p2, zhang, tiaoTiao, res, dog }